﻿using System;
using Dapper;

namespace ExtendLib.Helper
{
    /// <summary>
    /// 日志记录
    /// </summary>
    [Table("LogInfo")]
    public class LogModel
    {
        [Key]
        public int Id { get; set; }
        /// <summary>
        /// 日志信息
        /// </summary>
        public string LogMsg { get; set; }

        /// <summary>
        ///时间
        /// </summary>
        public string CreateTime { get; set; }
    }

    public class LogHelper
    {
        /// <summary>
        /// 日志记录
        /// </summary>
        /// <param name="msg"></param>
        public static void WirteLog(string msg)
        {
            var model = new LogModel
            {
                LogMsg = msg,
                CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
            };
            DbHelperByDapper.InsertDb(model);
        }
    }
}
